/*
 * @Author: xuxu12138 1718324422@qq.com
 * @Date: 2023-12-01 10:57:34
 * @LastEditors: xuxu12138 1718324422@qq.com
 * @LastEditTime: 2024-01-03 16:09:56
 * @FilePath: /things-admin/src/base/api/Question.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import {request} from '@/base/Request';
import { Question } from '@/base/model/Question';
 

//创建问卷 /api/question
export const CreateQuestion  = (params:{
    id:Number,
    modelId:Number,
    questionnaireSpecificVos:[],
    questionnaireName:String,
    status:Number,
    created: String,
    endTime: String,
    sex: any,
    provinceId: any,
    memberIds : [],
    cityId: any,
    displayRange:Number
}) => request.post(Question,'/api/questionnaire/complete',params)


// 全部数据 /api/questionnaire
export const questionAll = (params:{
    pageIndex:Number,
    pageSize:Number,
    sortDirection:String,
    modelId: Number,
    status:Number,

    questionnaireName:String
}) => request.get(Question,`/api/questionnaire?pageIndex=${params.pageIndex}&pageSize=${params.pageSize}&sortDirection=${params.sortDirection}&modelId=${params.modelId}&questionnaireName=${params.questionnaireName}`)


// 根据id查询完整问卷 /api/questionnaire/complete/{id}
export const questionnaireIDCope = (id) => request.get(Question,`/api/questionnaire/questionnaireStatistics/${id}`)

export const questionnaireID = (id) => request.get(Question,`/api/questionnaire/complete/${id}`)

//修改问卷 /api/questionnaire
export const questionnaireEdit = (params:{
    id:Number,
    modelId:Number,
    questionnaireSpecificVos:[],
    questionnaireName:String,
    status:Number,
    startTime: String,
    endTime: String,
    range:number
}) => request.put(Question,'/api/questionnaire/complete',params)

//修改问卷状态  /api/questionnaire/updateStatus/{id}
export const updateStatus = (id) => request.get(Question,`/api/questionnaire/updateStatus/${id}`,)


// 根据问卷id的获取相应答卷会员 /api/questionnaire/members/{questionnaireId}
export const questionnaire = (params:{
    pageIndex:Number,
    pageSize:Number,
    questionnaireId:Number,
    phone:Number,
    nickname:String
}) => request.get(Question,`/api/questionnaire/members/${params.questionnaireId}?pageIndex=${params.pageIndex}&pageSize=${params.pageSize}&nickname=${params.nickname}&phone=${params.phone}`)

// 查询已提交的文教信息 /api/questionnaire/members/{questionnaireId}/{memberId}
export const questionnaired = (questionnaireId:Number,memberId:Number) => request.get(Question,`/api/questionnaire/members/${questionnaireId}/${memberId}`)

//删除数据 /api/questionnaire/{id}
export const questionnairedelete = (id) => request.delete(`/api/questionnaire/${id}`)

//查询数据 /api/questionnaire/{id}
export const searchquestion = (id) => request.get(Question,`/api/questionnaire/${id}`)



